//
//  StoreNameTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/10.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "StoreNameTableViewCell.h"

@implementation StoreNameTableViewCell
{
    GLGWLabel * titbleLabel;
    GLGWLabel * inSaleLabel;
    GLGWLabel * saleLabel;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        titbleLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:self.contentView];
        [titbleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(19));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(20));
            make.right.equalTo(self.contentView.mas_right).offset(kWidthProportion_In_iPhoneTriploid(19));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(52));
        }];
        titbleLabel.text = @"小张店铺";
        titbleLabel.numberOfLines = 0;
        
        inSaleLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self.contentView];
        [inSaleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(20));
        }];
        inSaleLabel.text = @"在售商品0件";
        
        saleLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self.contentView];
        [saleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self->inSaleLabel.mas_right).offset(kWidthProportion_In_iPhoneTriploid(20));
            make.bottom.equalTo(self->inSaleLabel.mas_bottom);
        }];
        saleLabel.text = @"30天销售30件";
    }
    return self;
}

- (void)setModel:(StoreIntroduceModel *)model
{
    _model = model;
    StoreIntroduceDataModel *dataModel = model.data;
    titbleLabel.text = dataModel.shopName;
    NSString *num = 0;
    if (dataModel.productNum.length > 0) {
        num = dataModel.productNum;
    }
    NSString *inSaleStr = [NSString stringWithFormat:@" 在售商品%@件",num];
    inSaleLabel.attributedText = [GLGWLabel addImageName:@"icon_zaishoushangpin" theImageFram:CGRectMake(0, -3, kWidthProportion_In_iPhoneTriploid(14), kHeightProportion_In_iPhoneTriploid(14)) theTextString:inSaleStr atImageIndex:0];
    NSString *saleNum = 0;
    if (dataModel.volume.length > 0) {
        saleNum = dataModel.volume;
    }
    NSString *saleStr = [NSString stringWithFormat:@" 30天销售%@件",saleNum];
    saleLabel.attributedText = [GLGWLabel addImageName:@"icon_chengjiao" theImageFram:CGRectMake(0, -3, kWidthProportion_In_iPhoneTriploid(14), kHeightProportion_In_iPhoneTriploid(14)) theTextString:saleStr atImageIndex:0];
}

@end
